home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
050
/
madtrb8.arc
/
INKEYGET.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-02-23
|
2KB
|
56 lines
var
specialkey : boolean;
command : char;
function inkey(var special : boolean; var keychar : char) : boolean;
var
dosrec : record ax,bx,cx,dx,bp,si,di,ds,es,flags : integer; end;
begin
if keypressed
then
begin
dosrec.ax := $0800;
msdos(dosrec);
keychar := chr(lo(dosrec.ax));
inkey := true;
if ord(keychar) = 0
then
begin
special := true;
dosrec.ax := $0800;
msdos(dosrec);
keychar := chr(lo(dosrec.ax));
end
else special := false;
end
else
begin
inkey := false;
special := false;
end;
end;
begin
clrscr;
writeln('Press any key -- F10 to quit');
writeln;
command := #00;
repeat
if inkey(specialkey,command)
then
begin
if specialkey
then writeln('Special key -- ascii code is ',ord(command))
else writeln('Regular key -- ascii code is ',ord(command));
writeln;
if command <> #68
then writeln('Press any key -- F10 to quit.');
writeln;
end;
until command = #68;
end.